package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 公告表
 * </p>
 *
 * @author cnswhy
 * @since 2020-10-18
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_notice")
@ApiModel(value = "Notice", description = "公告表")
@AllArgsConstructor
public class Notice extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 公告标题
     */
    @ApiModelProperty(value = "公告标题")
    @NotEmpty(message = "公告标题不能为空")
    @Length(max = 500, message = "公告标题长度不能超过500")
    @TableField(value = "title", condition = LIKE)
    @Excel(name = "公告标题")
    private String title;

    @ApiModelProperty(value = "")
    @Length(max = 65535, message = "长度不能超过65535")
    @TableField("content")
    @Excel(name = "")
    private String content;

    /**
     * 发布状态：0-未发布 1-已发布 2-删除
     */
    @ApiModelProperty(value = "发布状态：0-未发布 1-已发布 2-删除")
    @TableField("status")
    @Excel(name = "发布状态：0-未发布 1-已发布 2-删除")
    private Integer status;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @TableField("create_date")
    @Excel(name = "创建时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime createDate;

    /**
     * 修改时间
     */
    @ApiModelProperty(value = "修改时间")
    @TableField("update_date")
    @Excel(name = "修改时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime updateDate;

    @ApiModelProperty(value = "")
    @TableField("orga_id")
    @Excel(name = "")
    private Long orgaId;

    /**
     * 0未读，1已读
     */
    @ApiModelProperty(value = "0未读，1已读")
    @NotNull(message = "0未读，1已读不能为空")
    @TableField("isRead")
    @Excel(name = "0未读，1已读")
    private Integer isRead;

    @ApiModelProperty(value = "")
    @TableField("notice_type")
    @Excel(name = "")
    private Integer noticeType;


    @Builder
    public Notice(Long id, 
                    String title, String content, Integer status, LocalDateTime createDate, LocalDateTime updateDate, 
                    Long orgaId, Integer isRead, Integer noticeType) {
        this.id = id;
        this.title = title;
        this.content = content;
        this.status = status;
        this.createDate = createDate;
        this.updateDate = updateDate;
        this.orgaId = orgaId;
        this.isRead = isRead;
        this.noticeType = noticeType;
    }

}
